﻿
namespace EasyTest
{
    public class Select:IElement
    {
        
        /// <summary>
        /// 
        /// </summary>
        /// <param name="findBy">HTML text to identify and find elements within a document.</param>
        public Select(string findBy):this(findBy,null,null) {
        }

        /// <summary>
        /// 
        /// </summary>
        /// <param name="findBy">HTML text to identify and find elements within a document.</param>
        /// <param name="focus">Document container with controls to search for.</param>
        public Select(string findBy, Focus focus)
            : this(findBy,null,focus) {}

        /// <summary>
        /// 
        /// </summary>
        /// <param name="findBy">HTML text to identify and find elements within a document.</param>
        /// <param name="parentElement"></param>
        /// <param name="focus">Document container with controls to search for.</param>
        public Select(string findBy, IElement parentElement, Focus focus)
        {
            FindBy = findBy;
            Focus = focus;
            ParentElement = parentElement;
        }

        public virtual string GetValue()
        {
            Focus.Go();
            return Action.GetValue(FindBy);
        }
        public virtual void VerifyValue(string valueToVerify)
        {
            VerifyValue(valueToVerify,"");
        }
        public virtual void VerifyValue(string valueToVerify,string errorMessage)
        {
            Focus.Go();
            Action.VerifyValue(FindBy,valueToVerify,errorMessage);
        }

    }
}
